<?php 
class Response{

    static public function jsonError($msg = false , $errors = false){
       //@ob_end_clean();
        echo json_encode(array('success'=>false , 'msg'=>$msg ,'errors'=>$errors));
        exit();
    }
    
    static public function jsonSuccess($data = array() , array $params = array()){
       // @ob_end_clean();
        $result = array(
            'success'=>true ,
             'data'=>$data
        );
        if(!empty($params))
            foreach ($params as $k=>$v)
                $result[$k] = $v;
                
        echo json_encode($result); 
        exit();
    }
    
    static public function jsonArray(array $data){
       // @ob_end_clean();
        echo json_encode($data);
        exit();
    }
    
    static public function put($html){
        echo $html;
    }
    
   /**
    * Send redirect header
    * @param string $location
    */
    static public function redirect($location){
    	header("Location: $location");
    	exit;
    }
}